{% extends 'base.html' %}
{% block content %}
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
                <form action="/cron" method="post">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">新建定时任务</div>
						<div class="layui-card-body">
							<div id="cronStaticDiv"></div>
							<input type="text" class="layui-input" id="cronVal" name='crontab' value="0 0 0 1,3,5 * ?" />
						</div>
					</div>
				</div>
            	<div class="layui-col-md12">
                    <div class="layui-card">
						<div class="layui-card-header">任务内容</div>
						<div class="layui-card-body">
							<div id="cronStaticDiv"></div>
							<input type="text" class="layui-input" name='cmd' id="cronVal2" value="shll 脚本 or 命令" />
						</div>
					</div>
				</div>

            	<div class="layui-col-md12">
                    <div class="layui-card">
						<div class="layui-card-header">目标主机</div>
						<div class="layui-card-body">
							<div id="cronStaticDiv"></div>
							<input type="text" class="layui-input" name='host' id="cronVal3" value="远程主机" />
						</div>
					</div>
				</div>

				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">确定任务无错误后即可创建</div>
						<div class="layui-card-body">
							<div class="layui-btn-group">
                                <button type="submit" class="layui-btn" >创建</button>
							</div>
						</div>
					</div>
				</div>
                </form>

                    <div class="layui-col-md12">
                     <div class="layui-card">
			            <div class="layui-card-header">任务列表</div>
			                <div class="layui-card-body">
				            <div id="cronStaticDiv"></div>
                                <table class="layui-table">
                                    <th>主机</th>
                                    <th>任务内容</th>
                                    <th>启用</th>
                                    <th>删除</th>
                                    {% for i in result %}
                                    <tr>
                                        <td>{{ i[0] }}</td>
                                        <td>{{ i[1] }}</td>
                                        <td>启用</td>
                                        <td>delete</td>
                                    </tr>
                                    {% endfor %}
                                </table>
				            </div>
		                </div>
	                </div>
			</div>
		</div>



{% endblock %}

{% block js %}
    <script src="../static/layui/layui.js"></script>
		<script src="../static/layui/layui.js?t=1"></script>
		<script>
			layui
				.config({
					base: "../static/layui_exts/"
				})
				.extend({
					cron: "cron/cron",
				})
				.use(["cron"], function() {
					var $ = layui.$,
						cron = layui.cron;
					cron.render({
						elem: "#cronVal", // 绑定元素
						run: "../static/json/run.json", // 获取最近运行时间的接口
						lang:'cn',
						btns:['confirm'], // 只显示确认按钮
						done: function(cronStr) {
							console.log(cronStr);
						}
					});



				});
		</script>
<style type="text/css">
	html{
		background-color: #f2f2f2;
		color: #666;
	}
	.layui-fluid{
		padding: 15px;
	}
</style>

{% endblock %}